{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from PIL import Image\n",
    "\n",
    "def convert_and_resize_image(input_path, output_path, size=(128, 128)):\n",
    "    # 打开JPEG图像\n",
    "    with Image.open(input_path) as img:\n",
    "        # 调整图像大小\n",
    "        img_resized = img.resize(size, Image.LANCZOS)\n",
    "        \n",
    "        # 保存为PNG格式\n",
    "        img_resized.save(output_path, 'PNG')\n",
    "\n",
    "# 使用示例\n",
    "input_image = '/Users/allwefantasy/projects/auto-coder/ide_plugins/vscode/auto-coder/logo.jpeg'  # 替换为您的输入JPEG文件路径\n",
    "output_image = '/Users/allwefantasy/projects/auto-coder/ide_plugins/vscode/auto-coder/logo-128-128.png'  # 输出PNG文件的路径\n",
    "convert_and_resize_image(input_image, output_image)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "byzerllm",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "name": "python",
   "version": "3.10.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
